OBJ:=obj/local/arm64-v8a/

build: cow
	ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android.mk APP_PLATFORM=android-21 APP_ABI=arm64-v8a
	mv cow ${OBJ}

push: build
	adb wait-for-device
	adb shell mkdir -p /data/local/tmp/mnt
	adb push ${OBJ}/su /data/local/tmp/mnt
	adb push ${OBJ}/cow /data/local/tmp
	adb push ${OBJ}/test /data/local/tmp


CROSS:=aarch64-linux-gnu-

bare: cow su test cowcp

%.o: %.c
	${CROSS}gcc -c -o $@ $<

cow: main.o
	${CROSS}gcc -static -pthread $^ -o $@

cowcp: cowcp.o
	${CROSS}gcc -static -pthread $^ -o $@

su: su.o
	${CROSS}gcc -static $< -o $@

test: test.o
	${CROSS}gcc -static $< -o $@

clean:
	rm -rf libs obj
